package org.agony2d.gpu {
	import org.agony2d.core.agony_internal;
	import org.agony2d.debug.Logger;
	import org.agony2d.gpu.supportClasses.CommonGroupAABase;
	
	use namespace agony_internal;
	
	/** [ StateGroupAA ]
	 *  [◆]
	 *  	1.  stateArgs
	 *  [◆◆]
	 *  	1.  reset
	 *  	2.  exit
	 */
public class StateGroupAA extends CommonGroupAABase {
  
    public function StateGroupAA( stateAARef:Class ) {
		if (!stateAARef) {
			Logger.reportError(this, "constructor", "Param stateAARef can't be null...!!")
		}
		m_stateAARef = stateAARef
    }
	
	public function get stateArgs() : Array {
		return m_stateArgs
	}
	
	public function set stateArgs( v:Array ) : void {
		m_stateArgs = v
	}
	
	public function reset() : void {
		this.doExit()
		this.doStart()
	}
	
	public function exit() : void {
		this.doExit()
	}
	
	
	agony_internal var m_stateAARef:Class
	agony_internal var m_state:StateAA
	agony_internal var m_stateArgs:Array
	
	
	override agony_internal function dispose() : void {
		if (m_state) {
			m_state.exit()
		}
		super.dispose()
	}
	
	agony_internal function doStart() : void {
		m_state = new m_stateAARef
		this.setting(m_state.fullTex, m_state.tinted, m_state.smoothing)
		m_state.m_group = this
		m_state.m_stateArgs = m_stateArgs
		m_state.enter()
	}
	
	agony_internal function doExit() : void {
		if (m_state) {
			m_state.exit()
			this.removeAllListeners()
			this.removeAllNodes()
			this.identity()
			m_state = null
		}
	}
	
}
}